<?php
class Shop_SearchController extends Zend_Controller_Action {

	public $skin = array(
		'index' => array(
			'personalized' => true,
			'layout' => 'shop_search_display'
		)
	);

	public $acl = array(
		'index' => 'show',
	);
	
	public function indexAction() {
		$config = $this->_helper->config('config.ini');

		/* @var $rq Zend_Controller_Request_Http */
		$rq = $this->getRequest();
		
		$page   = $rq->getParam('page', 1);
		$onPage = $config->paginator->onPage;
		
		$name  = $rq->getParam('name');
		$price = $rq->getParam('price');
		$attrs = $rq->getParam('attr');
		
		$model = new Shop_Model_Search();
		
		@list($rowset, $select) = $model->find($name, $price, $attrs, $page, $onPage);
		$this->view->rowset = $rowset;

			$paginator = Zend_Paginator::factory($select);
			$paginator->setCurrentPageNumber($page);
			$paginator->setItemCountPerPage($onPage);

		$this->view->paginator = $paginator;
	}
}